package com.adminLogin.app.service.impl;


import com.adminLogin.app.dao.AdminMapper;
import com.adminLogin.app.entity.Admin;
import com.adminLogin.app.service.AdminService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.tomcat.util.bcel.classfile.ClassFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin AdminLogin(String adminName, String adminPassword) {
//        System.out.println(adminName);
//        System.out.println(adminPassword);
        QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("admin_name", adminName);
        Admin admin1 = adminMapper.selectOne(queryWrapper);
        if (admin1 == null){
            System.out.println("用户名错误!");
        }
        if (!admin1.getAdminPassword().equals(adminPassword)){
            System.out.println("密码错误");
            return null;
        }else{
            return admin1;
        }

    }

}